
//roll 翻滚
define(['progress.min'], function() {
  var mySwiper = new Swiper('.swiper-container', {
    progress: true,
    loop: false,
    onProgressChange: function(swiper) {
      for (var i = 0; i < swiper.slides.length; i++) {
        var slide = swiper.slides[i];
        var progress = slide.progress;
        var rotate = -180 * progress;
        if (rotate < -180) rotate = -180;
        if (rotate > 180) rotate = 180;
        var translate = progress * swiper.width;
        swiper.setTransform(slide, 'translate3d(' + translate + 'px,0,' + -Math.abs(progress) * 500 + 'px)');
        swiper.setTransform(slide.querySelector('.flip-container'), 'rotateY(' + rotate + 'deg)');
      }
    },
    onTouchStart: function(swiper) {
      for (var i = 0; i < swiper.slides.length; i++) {
        swiper.setTransition(swiper.slides[i], 0);
        swiper.setTransition(swiper.slides[i].querySelector('.flip-container'), 0);
      }
    },
    onSetWrapperTransition: function(swiper, speed) {
      for (var i = 0; i < swiper.slides.length; i++) {
        swiper.setTransition(swiper.slides[i], speed);
        swiper.setTransition(swiperollr.slides[i].querySelector('.flip-container'), speed);
      }
    },
    onSlideChangeEnd: function(swiper) {
      window.initAni($(swiper.visibleSlides), swiper.activeLoopIndex);
      window.clearAni($(swiper.wrapper).children().eq(swiper.previousIndex));
    }
  })
});
